package pl.wr.physics.units.quantum.energy;

import pl.wr.math.number.Fraction;
import pl.wr.physics.units.AbstractUnit;
import pl.wr.physics.units.Constants;
import pl.wr.physics.units.SI.Prefix;
import pl.wr.physics.units.SI.derived.J;
import pl.wr.physics.units.quantum.QuantumUnit;

/**
 * Electronvolt as unit of energy, 1 eV = 1 e · 1 V
 * 
 * @version 1.0
 * @author wieslaw.rodak
 * 
 */
public final class eV extends AbstractUnit implements QuantumUnit {

	public static final String symbol = "eV";

	/**
	 * electronvolt
	 * 
	 * @param value
	 *            in <code>int</code>
	 */
	public eV(int value) {
		this(Prefix.basic, value);
	}

	/**
	 * electronvolt
	 * 
	 * @param value
	 *            in <code>float</code>
	 */
	public eV(float value) {
		this(Prefix.basic, value);
	}

	/**
	 * electronvolt
	 * 
	 * @param value
	 *            in <code>Fraction</code>
	 */
	public eV(Fraction value) {
		this(Prefix.basic, value);
	}

	/**
	 * electronvolt
	 * 
	 * @param p
	 *            - prefix SI
	 * @param value
	 *            - value in <code>int</code>
	 */
	public eV(Prefix p, int value) {
		super(p, value, eV.class.getSimpleName());
	}

	/**
	 * electronvolt
	 * 
	 * @param p
	 *            - prefix SI
	 * @param value
	 *            - value in <code>float</code>
	 */
	public eV(Prefix p, float value) {
		super(p, value, eV.class.getSimpleName());
	}

	/**
	 * electronvolt
	 * 
	 * @param p
	 *            - prefix SI
	 * @param value
	 *            - value in <code>Fraction</code>
	 */
	public eV(Prefix p, Fraction value) {
		super(p, value, eV.class.getSimpleName());
	}

	/**
	 * electronvolt
	 * 
	 * @param numerator
	 * @param denominator
	 */
	public eV(int numerator, int denominator) {
		this(Prefix.basic, new Fraction(numerator, denominator, 0));
	}

	@Override
	public J getSIValue() {
		return new J(Fraction.multiply(this.getValue(), Constants.e.getValue()));
	}
}
